package com.shengcheng.service.impl;

import com.shengcheng.entity.UserAccountDetail;
import com.shengcheng.mapper.UserAccountDetailMapper;
import com.shengcheng.service.UserAccountDetailService;
import com.shengcheng.util.AuthContextHolder;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 用户账户明细 服务实现类
 * </p>
 *
 * @author 强哥
 * @since 2023-12-16
 */
@Service
public class UserAccountDetailServiceImpl extends ServiceImpl<UserAccountDetailMapper, UserAccountDetail> implements UserAccountDetailService {

    @Override
    public void getUserAccountDetailByPage(IPage<UserAccountDetail> pageParam, String tradeType) {
        //获取到用户Id
        Long userId = AuthContextHolder.getUserId();
        //交易类型：1201-充值 1202-锁定 1203-解锁 1204-消费
        LambdaQueryWrapper<UserAccountDetail> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(UserAccountDetail::getUserId,userId);
        wrapper.eq(UserAccountDetail::getTradeType,tradeType);
        page(pageParam,wrapper);
    }
}
